package com.woniuxy.dr_mall.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.dr_mall.entity.DrUserFavorite;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 张哲轩
 * @since 2021-08-11
 */
public interface DrUserFavoriteMapper extends BaseMapper<DrUserFavorite> {

    //通过用户id和商品id删除用户收藏的信息 2021-8-16 叶官鑫
    @Delete("DELETE FROM dr_user_favorite WHERE userId=#{userId} AND productId=#{productId}")
    void deleteFavorite(int userId,int productId);

    @Insert("insert into dr_user_favorite(userid,productid,time) values(#{userId},#{productId},#{time})")
    void add(DrUserFavorite userFavorite);
}
